/**
 * @author shenli520
 */
define(function(require, exports, module){
    var $ = require('jquery');
    exports.amountChange = function() {
		$("#amountAdd").click(
			function(){
				var oldAmount=$("#J_IptAmount").val();
				$("#J_IptAmount").val(++oldAmount);
			}
		);
		$("#amountDec").click(
			function(){
				var oldAmount=$("#J_IptAmount").val();
				if(oldAmount>0)
				$("#J_IptAmount").val(--oldAmount);
			}
		);
	};
    exports.treeFold = function(className) {
		$("."+className+"").click( function() {
            var grade = $(this).parent().attr("grade");
            var isHide;
            $(this).parent().nextAll("tr").each(function(){
                var thisLevel = $(this).attr("grade");
                if(thisLevel <=  grade) {
                    return false;
                }
                if(isHide == null) {
                    if($(this).is(":hidden")){
                        isHide = true;
                    } else {
                        isHide = false;
                    }
                }
                if( isHide) {
                    $(this).show();
                } else {
                    $(this).hide();
                }
            });
	   })
	}
	

//define end part	
});